package com.tjec.project.mdmSynchronous.dao.impl;

import com.tjec.common.utils.StringUtils;
import com.tjec.project.mdmSynchronous.dao.BusinessMigrateDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

/**
 * @wjq
 * @date2019/8/29
 */
@Service
public class BusinessMigrateImpl implements BusinessMigrateDao {

    @Autowired
    private JdbcTemplate primaryJdbcTemplate;

	@Override
	public int updateProjectCodeAndId(String businessId,String projectGlobalId,String projectCode) {
		//OA_yw_实施台帐_咨询报告管理
		//OA_yw_实施台账_招标代理管理
		//OA_yw_实施台账_造价报告管理
		//OA_yw_实施流程_项目咨询报告盖章申请
		//OA_yw_实施台账_招标代理过程文件
		//OA_yw_实施流程_项目规划报审
		//OA_yw_实施流程_项目资料盖章申请
		//OA_yw_实施流程_项目资料归档
		int result = 0; 
		if(StringUtils.isNotBlank(businessId)) {
			String sql1="update OA_yw_实施台帐_咨询报告管理 set 项目代码='"+projectCode+"',项目全局ID='"+projectGlobalId+"' where [业务ID]='"+businessId+"'";
			String sql2="update OA_yw_实施台账_招标代理管理 set 项目代码='"+projectCode+"',项目全局ID='"+projectGlobalId+"' where [业务ID]='"+businessId+"'";
			String sql3="update OA_yw_实施台账_造价报告管理 set 项目代码='"+projectCode+"',项目全局ID='"+projectGlobalId+"' where [业务ID]='"+businessId+"'";
			String sql4="update OA_yw_实施流程_项目咨询报告盖章申请 set 项目代码='"+projectCode+"',项目全局ID='"+projectGlobalId+"'where [业务ID]='"+businessId+"'";
			String sql5="update OA_yw_实施台账_招标代理过程文件 set 项目代码='"+projectCode+"',项目全局ID='"+projectGlobalId+"' where [业务ID]='"+businessId+"'";
			String sql6="update OA_yw_实施流程_项目规划报审 set 项目代码='"+projectCode+"',项目全局ID='"+projectGlobalId+"' where [业务ID]='"+businessId+"'";
			String sql7="update OA_yw_实施流程_项目资料盖章申请 set 项目代码='"+projectCode+"',项目全局ID='"+projectGlobalId+"' where [业务ID]='"+businessId+"'";
			String sql8="update OA_yw_实施流程_项目资料归档 set 项目代码='"+projectCode+"',项目全局ID='"+projectGlobalId+"'where [业务ID]='"+businessId+"'";
			
			result = primaryJdbcTemplate.update(sql1);
			result = primaryJdbcTemplate.update(sql2);
			result = primaryJdbcTemplate.update(sql3);
			result = primaryJdbcTemplate.update(sql4);
			result = primaryJdbcTemplate.update(sql5);
			result = primaryJdbcTemplate.update(sql6);
			result = primaryJdbcTemplate.update(sql7);
			result = primaryJdbcTemplate.update(sql8);
		}
		return result;
	}

   /* @Override
    public int updateCostNoStatus(String businessId,String status) {
    	if(StringUtils.isNotBlank(businessId) && StringUtils.isNotBlank(businessId)) {
    		String sql="update OA_yw_实施台账_造价报告管理 set EC业务状态='"+status+"' where [业务ID]='"+businessId+"'";
    		return primaryJdbcTemplate.update(sql);
    	}else {
    		return 1;
    	}
    }
    */

}
